package com.project.poetry.service.controller;

import com.project.poetry.service.entity.dto.poetry.PoetryListDTO;
import com.project.poetry.service.service.ExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 文件控制器
 * @author mengxj
 */
@Api("文件")
@RestController
@RequestMapping("export")
public class ExportController {

    @Resource
    private ExportService fileService;

    @ApiOperation("以excel形式下载作品列表")
    @GetMapping("poetryListExcel")
    public void poetryListExcel(PoetryListDTO poetryList, HttpServletResponse response){
        this.fileService.poetryListExcel(poetryList, response);
    }

    @ApiOperation("以pdf形式下载作品列表")
    @GetMapping("poetryListPdf")
    public void poetryListPdf(PoetryListDTO poetryList, HttpServletResponse response){
        this.fileService.poetryListPdf(poetryList, response);
    }
}
